<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: admin_inline_desc.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright © since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	© 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	© 2002-2003 osCommerce - www.oscommerce.com
* 	© 2003     nextcommerce - www.nextcommerce.org
* 	© 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

chdir('../../../');
include('includes/application_top.php');

function check_type($type) {
	global $db;
	
	$check_for_desc = $db->db_query("SELECT 
										p_short_desc,
										p_short_desc_lenght,
										p_long_desc,
										p_long_desc_lenght
									FROM
										".TABLE_PRODUCTS_LISTINGS."
									WHERE
										list_name = 'product_listing_".$type."'");

	if($check_for_desc->fields['p_short_desc'] == 1)
		return array('name' => 'products_short_description', 'lenght' => $check_for_desc->fields['p_short_desc_lenght']);
	elseif($check_for_desc->fields['p_long_desc'] == 1)
		return array('name' => 'products_description', 'lenght' => $check_for_desc->fields['p_long_desc_lenght']);
	else
		return;
}

$field = check_type($_POST['type']);

if(!empty($field['name'])) {
	$data = $db->db_query("SELECT
								".$field['name']."
							FROM
								".TABLE_PRODUCTS_DESCRIPTION."
							WHERE
								products_id = '".(int)$_POST['pID']."'
							AND
								language_id = '".(int)$_SESSION['languages_id']."'");
								
	echo $data->fields[$field['name']];
}
